package cn.jia.spring2.pojo.InterfaceImpl;

import cn.jia.spring2.pojo.myInterface.CompactDisc;
import cn.jia.spring4.annotation.BlankAnnotation;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by jia on 2018/3/29.
 */
//@Component
@BlankAnnotation
public class BlankDisc implements CompactDisc {
    private String title;
    private String artist;
    private List<String> tracks;//磁道

    public BlankDisc() {

    }

    public BlankDisc(String title, String artist, List<String> tracks) {
        this.title = title;
        this.artist = artist;
        this.tracks = tracks;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public void setArtist(String artist) {
        this.artist = artist;
    }

    public void setTracks(List<String> tracks) {
        this.tracks = tracks;
    }

    @Override
    public String toString() {
        return "BlankDisc{" +
                "title='" + title + '\'' +
                ", artist='" + artist + '\'' +
                ", tracks=" + tracks +
                '}';
    }

    @Override
    public void play() {
        System.out.println("Playing" + title + "by" + artist);
        for (String track : tracks) {
            System.out.println("-Track" + track);
        }
    }

    //获取某个磁道进行打印
    @Override
    public void playTrack(int number,int x) {
        if (number <= tracks.size()) {
            System.out.println(tracks.get(number));
        }

    }
}
